namespace DB_EntityFramework.Migrations
{
    using System;
    using System.Data.Entity;
    using System.Data.Entity.Migrations;
    using System.Linq;

    internal sealed class Configuration : DbMigrationsConfiguration<DB_EntityFramework.UserManaging.UserContext>
    {
        public Configuration()
        {
            AutomaticMigrationsEnabled = false;
        }

        protected override void Seed(DB_EntityFramework.UserManaging.UserContext context)
        {
            //  This method will be called after migrating to the latest version.

            //  You can use the DbSet<T>.AddOrUpdate() helper extension method 
            //  to avoid creating duplicate seed data. E.g.
            //
            //    context.People.AddOrUpdate(
            //      p => p.FullName,
            //      new Person { FullName = "Andrew Peters" },
            //      new Person { FullName = "Brice Lambson" },
            //      new Person { FullName = "Rowan Miller" }
            //    );
            //

            //UserManaging.UserContext ctx = new UserManaging.UserContext();
            //Sity Rivne = new Sity { Name = "Rivne" };
            //Roles role = new Roles { Name = "Admin" };
            //Employee emloyee = new Employee() { City = Rivne, BirthDay = DateTime.Parse("11-1-1911"), Email = "jhon.smith@i.com", Id = 1, LastName = "Smith", Login = "jhon", Name = "Jhon", Password = "12345", Phone = "12345678" };
            //emloyee.Roles.Add(role);
            //context.Emploees.AddOrUpdate(
            //    emloyee
            //);

            //UserManaging.UserContext ctx = new UserManaging.UserContext();
            //Sity Lviv = new Sity { Name = "Lviv" };
            //Roles role = new Roles { Name = "Employee" };
            //Employee emloyee = new Employee() { City = Lviv, BirthDay = DateTime.Parse("12-12-1983"), Email = "sara.conor@i.com", Id = 2, LastName = "Conor", Login = "Sara", Name = "Jhon", Password = "123456", Phone = "123456789" };
            //emloyee.Roles.Add(role);
            //context.Emploees.AddOrUpdate(
            //    emloyee
            //);

            UserManaging.UserContext ctx = new UserManaging.UserContext();
            Sity Lviv = new Sity { Name = "Lviv" };
            Roles role = new Roles { Name = "Employer" };
            Employee emloyee = new Employee() { City = Lviv, BirthDay = DateTime.Parse("10-10-1983"), Email = "tom.soyer@i.com", Id = 3, LastName = "Soyer", Login = "Tom", Name = "Tom", Password = "1234567", Phone = "1234567890" };
            emloyee.Roles.Add(role);
            context.Emploees.AddOrUpdate(
                emloyee
            );
        }
    }
}
